package logic.common.game;

import gameStates.absGamesStates.AbsIngameState;

import interfaces.hud.BasicHUD;
import interfaces.hud.topWindows.TDMStatusWindow;

import org.fenggui.StandardWidget;

import logic.common.game.endConditions.ScoreCondition;
import logic.common.game.endConditions.TimeOutCondition;
import logic.common.player.Player;
import logic.common.team.Team;
import map.spawnStation.SpawnPosition;
import map.spawnStation.SpawnPositionController;

public class TDMSetup extends GameSetup {
	
	public TDMSetup(Game game) {
		super(game);
	}
	
	@Override
	public void setupGame(AbsIngameState ingameState) {
		addTDMSpawnPos(game.getTeamA());
		addTDMSpawnPos(game.getTeamB());
		
		initAI();
	}
	
	protected void addTDMSpawnPos(Team team) {
		team.getSpawnPositions().add(new TDMSpawnPosition(team, game.getMap().getDimension()));
	}
	
	@Override
	public void addStandardMissions(Team team, Team enemyTeam) {}
	
	@Override
	public void initEndConditions() {
		new TimeOutCondition(game);
		new ScoreCondition(game);
	}
	
	@Override
	public StandardWidget getTopHUDElement(BasicHUD hud) {
		return new TDMStatusWindow(hud, game);
	}
	
	@Override
	public boolean hasMissions() { return false; }
	
	@Override
	public boolean hasMotherShips() { return false; }
	
	@Override
	protected void registerPlayerToSpawns(Player player) {
		for(SpawnPosition p : player.getTeam().getSpawnPositions()) {
			new SpawnPositionController(p, player);
		}
	}
	
	@Override
	public void initSpawnStations(AbsIngameState ingameState) {}
	
	@Override
	public boolean hasTeamStatusWindow() { return false; }
}